/*
 * ============================================================================
 * Copyright (c) Texas Instruments Inc 2007
 *
 * Use of this software is controlled by the terms and conditions found in the
 * license agreement under which this software has been supplied or provided.
 * ============================================================================
 */

#ifndef DAVINCI_RESIZER_INTERFACE_H
#define DAVINCI_RESIZER_INTERFACE_H
//#pragma pack(1)
/* ioctls definition */
#define MAGIC_NO 'R'

/////////////////Ioctl options which are to be passed while calling the ioctl
#define RSZ_REQBUF			_IOWR(MAGIC_NO,1, rsz_reqbufs_t *)
#define RSZ_QUERYBUF			_IOWR(MAGIC_NO,2,rsz_buffer_t  *)
#define RSZ_S_PARAM			_IOWR(MAGIC_NO,3,rsz_params_t *)
#define RSZ_G_PARAM			_IOWR(MAGIC_NO,4,rsz_params_t *)
#define RSZ_RESIZE			_IOWR(MAGIC_NO,5,rsz_resize_t *)
#define RSZ_G_STATUS			_IOWR(MAGIC_NO,6,rsz_status_t *)
#define RSZ_S_PRIORITY			_IOWR(MAGIC_NO,7,rsz_priority_t *)
#define RSZ_G_PRIORITY			_IOWR(MAGIC_NO,9,rsz_priority_t *)
/* Xiangdong Fu: added this new IOCTL to configure SDR_REQ_EXP */
#define RSZ_S_EXP			_IOWR(MAGIC_NO,10,int *)

#define RSZ_INTYPE_YCBCR422_16BIT	0
#define RSZ_INTYPE_PLANAR_8BIT         1
#define RSZ_CBILIN_DISABLE	0    /* same as luminance processing */
#define RSZ_CBILIN_ENABLE	1    /* enable bi-linear processing        */
#define RSZ_PIX_FMT_UYVY	0    /* cb:y:cr:y */
#define RSZ_PIX_FMT_YUYV	1    /* y:cb:y:cr */
#define RSZ_PIX_FMT_PLANAR	2    /* 8-bit planar input */
#define RSZ_YENH_DISABLE	0
#define	RSZ_YENH_3TAP_HPF	1
#define	RSZ_YENH_5TAP_HPF	2
#define N_INBUFS		3
#define N_OUTBUFS		3
#define RSZ_BUF_IN		0
#define	RSZ_BUF_OUT		1


typedef struct rsz_reqbufs
{
	int buf_type;   /* type of frame buffer */
	int size;   /* size of the frame buffer to be allocated */
	int count; /* number of frame buffer to be allocated */
}rsz_reqbufs_t;

typedef struct rsz_buffer
{
	int index;        /* buffer index number, 0 -> N-1 */
	int buf_type;  /* buffer type, input or output */
	int offset;      /* physical address of the buffer, 
                                   used in the mmap() system call */
	int size;
}rsz_buffer_t;

typedef struct rsz_yenh
{	
	int type;
	unsigned char gain;
	unsigned char slop;
	unsigned char core;
}rsz_yenh_t;


typedef struct rsz_params
{
	int in_hsize; 
	int in_vsize;
	int in_pitch;
	int inptyp;	// for determining 16 bit or 8 bit data
	int vert_starting_pixel; // for specifying vertical starting pixel in input
	int horz_starting_pixel; // for specyfing horizontal starting pixel in input
	int cbilin;        /* # defined, filter with luma or bi-linear interpolation  */
	int pix_fmt;      /* # defined, UYVY or YUYV */
	int out_hsize;
	int out_vsize;	
	int out_pitch;
	int hstph;	// for specifying horizontal starting phase
	int vstph;	// for specifying vertical starting phase
	short hfilt_coeffs[32];
	short vfilt_coeffs[32];	
	//int ycpos;
    rsz_yenh_t yenh_params;
}rsz_params_t;

typedef struct rsz_resize
{
	//void *in_buf;  /* address of the input buffer */
	//void *out_buf; /* address of the output buffer */
	rsz_buffer_t in_buf;
	rsz_buffer_t out_buf;

}rsz_resize_t;


typedef struct rsz_status 
{
	int chan_busy;   /* 1: channel is busy, 0: channel is not busy */
	int hw_busy;      /*  1: hardware is busy, 0: hardware is not busy */
	int src;  /* # defined, can be either SD-RAM or CCDC/PREVIEWER */
}rsz_status_t;

typedef struct rsz_priority
{
	int priority;   /* 0=>5, with 5 the highest priority */
}rsz_priority_t;
#endif
